﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo1
{
    class Program
    {
        static void Main(string[] args)
        {
            lo: while (true)
            {
                Console.WriteLine("请输入第一个数：");
                int num1 = int.Parse(Console.ReadLine());
                Console.WriteLine("请输入第二个数：");
                int num2 = int.Parse(Console.ReadLine());
                Console.WriteLine("请输入操作符：");
                char c = char.Parse(Console.ReadLine());
                Calculate calculate;
                switch (c)
                {
                    case '+':
                        calculate = new Plus(num1, num2);
                        break;
                    case '-':
                        calculate = new Minus(num1, num2);
                        break;
                    case '*':
                        calculate = new Multiply(num1, num2);
                        break;
                    case '/':
                        calculate = new Divide(num1, num2);
                        break;
                    default:
                        Console.WriteLine("操作符输入错误，请重新输入");
                        goto lo;
                }
                Console.Write("您输入的第一个数{0}，第二个数为{1}，操作符为{2},",num1,num2,c); 
                Calc(calculate);

            }

        }


        public static void Calc(Calculate calculate)
        {
            calculate.DisplayResult();
        }
    }
}
